package controllers

import (
	"stock_app/logic"
	"stock_app/models"

	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

func HandleAmountList(c *gin.Context) {
	p := new(models.ParamAmountList)
	if err := c.ShouldBindJSON(p); err != nil {
		zap.L().Error("ParamAmountList with invalid params", zap.Error(err))
		ResponseErrorWithMsg(c, CodeInvalidParam, err.Error())
		return
	}
	//获取数据
	data, err := logic.AmountList(p)
	if err != nil {
		zap.L().Error("logic.AmountList fail", zap.Error(err))
		ResponseError(c, CodeServerBusy)
		return
	}
	ResponseSuccess(c, data)
}
